package com.melon.swagweb;

import com.melon.entity.admin.User;
import com.melon.service.UserService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by zhiqi.shao on 2017/5/18.
 */
@RestController
@RequestMapping(value="/users")     // 通过这里配置使下面的映射都在/users下，可去除
public class UserSwagController {

    @Autowired
    private UserService userService;


    @ApiOperation(value="获取用户详细信息", notes="根据uid来获取用户详细信息")
    @ApiImplicitParam(name = "user", value = "用户ID", required = true, dataType = "User",defaultValue = "{\"uid\":\"2\"}")
    @RequestMapping(value="/userInfo", method= RequestMethod.POST)
    public Object adminIndex(@RequestBody User user){
        return  userService.getUser(user.getUid());

    }
}
